package thesis.ramstorage.util;

import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class TestRender {
	
	public static void main(String[] args){
		    try {
			    File file= new File("./resources/scenario_random.txt");
			    Writer output = new BufferedWriter(new FileWriter(file));
			    try {
			      //FileWriter always assumes default encoding is OK!
			    	List<Integer> listInt = new ArrayList<Integer>();
			    	for(int i = 0 ; i < 1000000; i++){
			    		listInt.add(i);
					}
			    	java.util.Collections.shuffle(listInt);
			    	Random r = new Random();
			    	List<Integer> isDeletedList = new ArrayList<Integer>();
			    	for(int i = 0; i < 500000; i++){
			    		int j = r.nextInt(500000);
			    		if(j % 3 ==0){
			    			output.write(String.valueOf("get " + j + " "));
			    		}else if(j % 3 == 1){
			    			output.write(String.valueOf("delete " + j + " "));
			    			isDeletedList.add(j);
			    		}else{
			    			Random r1 = new Random();
			    			int index = r1.nextInt(isDeletedList.size());
			    			output.write(" " +isDeletedList.get(index) + " ");
			    		}
			    		output.write(System.getProperty("line.separator"));
			    	}
			    }
			    finally {
			    	output.close();
			    }
		    } catch (IOException e) {
		    	e.printStackTrace();
		    }
//		  use buffering
	}
}
